const express = require('express')
const router = express.Router()

router.get('/getParameter', (req, res, next) => {

  console.log(req.query)
  console.log(req.query.sn)
  console.log(req.query.mac)
  res.json({
    code: 200,
    msg: '请求成功',
    data: {
      total: 100,
      heartbeat: 1000,
      list: [
        {
          ip: '192.168.3.1', 
          deviceName: '台式机1', 
          scanPeriod: 500
        },
        {
          ip: '192.168.3.2', 
          deviceName: '台式机2', 
          scanPeriod: 500
        }
      ]
    }
  })
})

router.post('/heartbeat', (req, res, next) => {
  console.log(req.query)
  console.log(req.query.sn)
  console.log(req.query.mac)
  res.json({
    code: 200,
    msg: '请求成功',
    data: {
    }
  })
})
router.post('/alarm', (req, res, next) => {
  console.log(req.query)
  console.log(req.query.sn)
  console.log(req.query.mac)
  console.log(req.body.ip)
  console.log(req.body.deviceName)
  console.log(req.body.time)
  console.log(req.body.type)
  // res.send(req.body) // echo the result back
  res.json({
    code: 200,
    msg: '请求成功',
    data: {
    }
  })
})
module.exports = router
